home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / cheekyms.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  6KB  |  219 lines

  1. /*************************************************************************
  2.  Universal Cheeky Mouse Driver
  3.  (c)Lee Taylor May/June 1998, All rights reserved.
  4.  
  5.  For use only in offical Mame releases.
  6.  Not to be distributed as part of any commerical work.
  7. **************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11.  
  12.  
  13.  
  14.  
  15. void cheekyms_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  16. void cheekyms_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  17. WRITE_HANDLER( cheekyms_sprite_w );
  18. WRITE_HANDLER( cheekyms_port_40_w );
  19. WRITE_HANDLER( cheekyms_port_80_w );
  20.  
  21.  
  22. static struct MemoryReadAddress readmem[] =
  23. {
  24.     { 0x0000, 0x1fff, MRA_ROM},
  25.     { 0x3000, 0x33ff, MRA_RAM},
  26.     { 0x3800, 0x3bff, MRA_RAM},    /* screen RAM */
  27.     { -1 }    /* end of table */
  28. };
  29.  
  30.  
  31. static struct MemoryWriteAddress writemem[] =
  32. {
  33.     { 0x0000, 0x1fff, MWA_ROM },
  34.     { 0x3000, 0x33ff, MWA_RAM },
  35.     { 0x3800, 0x3bff, videoram_w, &videoram, &videoram_size },
  36.     { -1 }    /* end of table */
  37. };
  38.  
  39. static struct IOReadPort readport[] =
  40. {
  41.     { 0x00, 0x00, input_port_0_r },
  42.     { 0x01, 0x01, input_port_1_r },
  43.     { -1 }    /* end of table */
  44. };
  45.  
  46. static struct IOWritePort writeport[] =
  47. {
  48.     { 0x20, 0x3f, cheekyms_sprite_w },
  49.     { 0x40, 0x40, cheekyms_port_40_w },
  50.     { 0x80, 0x80, cheekyms_port_80_w },
  51.     { -1 }    /* end of table */
  52. };
  53.  
  54.  
  55. static int cheekyms_interrupt(void)
  56. {
  57.     if (readinputport(2) & 1)    /* Coin */
  58.         return nmi_interrupt();
  59.     else return interrupt();
  60. }
  61.  
  62.  
  63. INPUT_PORTS_START( cheekyms )
  64.     PORT_START      /* IN0 */
  65.     PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
  66.     PORT_DIPSETTING(    0x00, "2" )
  67.     PORT_DIPSETTING(    0x01, "3" )
  68.     PORT_DIPSETTING(    0x02, "4" )
  69.     PORT_DIPSETTING(    0x03, "5" )
  70.     PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) )
  71.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  72.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ) )
  73.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_2C ) )
  74. //PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
  75.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
  76.     PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
  77.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  78.     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
  79.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  80.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  81.     PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life ) )
  82.     PORT_DIPSETTING(    0x40, "3000" )
  83.     PORT_DIPSETTING(    0x80, "4500" )
  84.     PORT_DIPSETTING(    0xc0, "6000" )
  85.     PORT_DIPSETTING(    0x00, "None" )
  86.  
  87.     PORT_START      /* IN1 */
  88.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  89.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  90.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL )
  91.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_COCKTAIL )
  92.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  93.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
  94.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
  95.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  96.  
  97.     PORT_START    /* FAKE */
  98.     /* The coin slots are not memory mapped. Coin  causes a NMI, */
  99.     /* This fake input port is used by the interrupt */
  100.     /* handler to be notified of coin insertions. We use IMPULSE to */
  101.     /* trigger exactly one interrupt, without having to check when the */
  102.     /* user releases the key. */
  103.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  104. INPUT_PORTS_END
  105.  
  106.  
  107.  
  108. static struct GfxLayout charlayout =
  109. {
  110.     8,8,    /* 16*16 sprites */
  111.     256,    /* 64 sprites */
  112.     2,    /* 2 bits per pixel */
  113.     { 0, 256*8*8 },    /* the two bitplanes are separated */
  114.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  115.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  116.     8*8    /* every sprite takes 8 consecutive bytes */
  117. };
  118.  
  119. static struct GfxLayout spritelayout =
  120. {
  121.     16,16,    /* 16*16 sprites */
  122.     64,    /* 64 sprites */
  123.     2,    /* 2 bits per pixel */
  124.     { 64*32*8, 0 },    /* the two bitplanes are separated */
  125.     { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
  126.     { 0*16, 1*16,  2*16,  3*16,  4*16,  5*16,  6*16,  7*16,
  127.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  128.     32*8    /* every sprite takes 32 consecutive bytes */
  129. };
  130.  
  131.  
  132.  
  133. static struct GfxDecodeInfo gfxdecodeinfo[] =
  134. {
  135.     { REGION_GFX1, 0, &charlayout,   0,    32 },
  136.     { REGION_GFX2, 0, &spritelayout, 32*4, 16 },
  137.     { -1 } /* end of array */
  138. };
  139.  
  140.  
  141. static struct DACinterface dac_interface =
  142. {
  143.     1,
  144.     { 100 }
  145. };
  146.  
  147.  
  148. static struct MachineDriver machine_driver_cheekyms =
  149. {
  150.     /* basic machine hardware */
  151.     {
  152.         {
  153.             CPU_Z80,
  154.             5000000/2,  /* 2.5 Mhz */
  155.             readmem, writemem,
  156.             readport, writeport,
  157.             cheekyms_interrupt,1
  158.         }
  159.     },
  160.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  161.     1,    /* single CPU, no need for interleaving */
  162.     0,
  163.  
  164.     /* video hardware */
  165.       32*8, 32*8, { 0*8, 32*8-1, 4*8, 28*8-1 },
  166.     gfxdecodeinfo,
  167.     64*3,64*3,
  168.     cheekyms_vh_convert_color_prom,
  169.  
  170.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
  171.     0,
  172.     generic_vh_start,
  173.     generic_vh_stop,
  174.     cheekyms_vh_screenrefresh,
  175.  
  176.     /* sound hardware */
  177.     0,0,0,0,
  178.     {
  179.         {
  180.             SOUND_DAC,
  181.             &dac_interface
  182.         }
  183.     }
  184. };
  185.  
  186.  
  187.  
  188.  
  189. /***************************************************************************
  190.  
  191.   Game driver(s)
  192.  
  193. ***************************************************************************/
  194.  
  195. ROM_START( cheekyms )
  196.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  197.     ROM_LOAD( "cm03.c5",       0x0000, 0x0800, 0x1ad0cb40 )
  198.     ROM_LOAD( "cm04.c6",       0x0800, 0x0800, 0x2238f607 )
  199.     ROM_LOAD( "cm05.c7",       0x1000, 0x0800, 0x4169eba8 )
  200.     ROM_LOAD( "cm06.c8",       0x1800, 0x0800, 0x7031660c )
  201.  
  202.     ROM_REGION( 0x1000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  203.     ROM_LOAD( "cm01.c1",       0x0000, 0x0800, 0x26f73bd7 )
  204.     ROM_LOAD( "cm02.c2",       0x0800, 0x0800, 0x885887c3 )
  205.  
  206.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  207.     ROM_LOAD( "cm07.n5",       0x0000, 0x0800, 0x2738c88d )
  208.     ROM_LOAD( "cm08.n6",       0x0800, 0x0800, 0xb3fbd4ac )
  209.  
  210.     ROM_REGION( 0x0060, REGION_PROMS )
  211.     ROM_LOAD( "cm.m8",         0x0000, 0x0020, 0x2386bc68 )     /* Character colors \ Selected by Bit 6 of Port 0x80 */
  212.     ROM_LOAD( "cm.m9",         0x0020, 0x0020, 0xdb9c59a5 )     /* Character colors /                                */
  213.     ROM_LOAD( "cm.p3",         0x0040, 0x0020, 0x6ac41516 )  /* Sprite colors */
  214. ROM_END
  215.  
  216.  
  217.  
  218. GAMEX( 1980?, cheekyms, 0, cheekyms, cheekyms, 0, ROT270, "Universal", "Cheeky Mouse", GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
  219.